#ifndef _HW_TRACING_H_
#define _HW_TRACING_H_

#include "ti_msp_dl_config.h"

/********************************I2C***************************************/
//设置SDA输出模式
#define TRACING_SDA_OUT()   {                                                  \
                        DL_GPIO_initDigitalOutput(TRACKING_IIC_SDA_IOMUX);     \
                        DL_GPIO_setPins(TRACKING_IIC_PORT, TRACKING_IIC_SDA_PIN);      \
                        DL_GPIO_enableOutput(TRACKING_IIC_PORT, TRACKING_IIC_SDA_PIN); \
                    }
//设置SDA输入模式
#define TRACING_SDA_IN()    { DL_GPIO_initDigitalInput(TRACKING_IIC_SDA_IOMUX); }

//获取SDA引脚的电平变化
#define TRACING_SDA_GET()   ( ( ( DL_GPIO_readPins(TRACKING_IIC_PORT,TRACKING_IIC_SDA_PIN) & TRACKING_IIC_SDA_PIN ) > 0 ) ? 1 : 0 )
//SDA与SCL输出
#define TRACING_SDA(x)      ( (x) ? (DL_GPIO_setPins(TRACKING_IIC_PORT,TRACKING_IIC_SDA_PIN)) : (DL_GPIO_clearPins(TRACKING_IIC_PORT,TRACKING_IIC_SDA_PIN)) )
#define TRACING_SCL(x)      ( (x) ? (DL_GPIO_setPins(TRACKING_IIC_PORT,TRACKING_IIC_SCL_PIN )) : (DL_GPIO_clearPins(TRACKING_IIC_PORT,TRACKING_IIC_SCL_PIN)) )
/***********************************************************************/
//定义灰度传感器地址
#define TRACING_ADDRESS 0x98

extern char tracing_data_O;//十进制

uint8_t i2c_scan(void);
int get_tracing_data(uint8_t dev_addr);
int tracing_Digital(void);
void O_TO_B(void);
int pingtracing(uint8_t dev_addr);
#endif
